//
//  File.swift
//
//
//  Created by didi on 2022/9/7.
//

import Vapor
import MolecularObjects

struct MolecularGuestUserAuthenticator: AsyncRequestAuthenticator {
    func authenticate(request req: Request) async throws {
        let role: Role? = try await req.invokeAllFirstAsync(.guestRole)
        req.auth.login(MUser(id: .init(), level: .guest, roles: [role].compactMap { $0 }))
    }
}
